package cn.intotw.rdcj.task.spiders.util;


import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpVersion;

import java.net.URI;

/**
 * Created by Chenxiang
 *
 * @generator: IntelliJ IDEA
 * @description: Http请求工厂类
 * @project: rdcj
 * @package: cn.intotw.rdcj.task.spiders.util
 * @date: 2020年07月24日 14时54分
 */
public final class HttpRequestFactory {
    public static FullHttpRequest newFullPostHttpRequest(String requestPath, String content){
        return new DefaultFullHttpRequest(
                HttpVersion.HTTP_1_1, HttpMethod.POST, requestPath, Unpooled.copiedBuffer(content.getBytes()));
    }
    public static FullHttpRequest newFullHttpRequest(HttpMethod httpMethod,String requestPath, String content){
        return new DefaultFullHttpRequest(
                HttpVersion.HTTP_1_1, httpMethod, requestPath, Unpooled.copiedBuffer(content.getBytes()));
    }
    public static FullHttpRequest newFullHttpRequest(HttpMethod httpMethod,String requestPath, ByteBuf content){
        return new DefaultFullHttpRequest(
                HttpVersion.HTTP_1_1, httpMethod, requestPath, content);
    }
}
